class MainPanel {
    private _view: gui.Package1.UI_Main;
    private static mainPanel: MainPanel;

    public constructor() {
        //可在此添加指定package
        fairygui.UIPackage.addPackage("Package1");
        fairygui.UIPackage.addPackage("Package2"); //因为此package应用了另外一个包的内容，所以也要添加相关包
        this._view = gui.Package1.UI_Main.createInstance();
    }

    public init() {
        fairygui.GRoot.inst.addChild(this._view);

        this._view.m_text.text = "456"; //更改原ui内容
        this._view.m_loader.icon = "resource/assets/3.png"; //使用MyGLoader
        console.log(this._view.m_block);
    }

    public static open() {
        //可在此处加载指定资源
        this.getInstance().init();
    }

    //获取单例
    public static getInstance(): MainPanel {
        if (!this.mainPanel) {
            this.mainPanel = new MainPanel();
        }
        return this.mainPanel;
    }
}
